home *** CD-ROM | disk | FTP | other *** search
/ Merciful 2 / Merciful - Disc 2.iso / software / d / dungeonmasterii1.dms / dungeonmasterii1.adf / DM2 Install < prev    next >
Text File  |  1995-08-14  |  13KB  |  458 lines

  1.  
  2. ;=========================================================================
  3. ;
  4. ; File: DM2_install_scpt
  5. ;
  6. ; DungeonMaster II installer script for use with Commodore installer.
  7. ;
  8. ; To do:
  9. ;   * Check errors on join and de-arc
  10. ;       The installer's (getenv) command doesn't seem to work.
  11. ;       An alternative might be to create a t:xxxx error file when
  12. ;       an error occurs, and check for errors using (exists).
  13. ;   * Write "append" util instead of using "join" which only
  14. ;       concatenates (and is painfully slooowww.)
  15. ;
  16. ; History:
  17. ;   BWK 18 Jul 95 -- Written; Bill Kelly
  18. ;   BWK  1 Aug 95 -- Added concatenating-files message.
  19. ;   BWK  2 Aug 95 -- Added creation of save game dir if necesary.
  20. ;
  21. ; Copyright (c) 1995 Software Heaven, Inc.  All Rights Reserved.
  22. ; Installer and Installer project icon
  23. ; (c) Copyright 1991-93 Commodore-Amiga, Inc.  All Rights Reserved.
  24. ; Reproduced and distributed under license from Commodore.
  25. ;
  26. ;=========================================================================
  27.  
  28.  
  29.  
  30. ;=========================================================================
  31. ; Define constants
  32. ;=========================================================================
  33.  
  34.  
  35. (set ENGL "English")
  36. (set FNCH "French")
  37. (set GRMN "German")
  38.  
  39. (set INSTALL_SPACE          11000000)   ; 11 megs required during install
  40. (set FINAL_SPACE            6000000)    ; 6 megs permanent after install
  41.  
  42. (set NUM_INSTALL_FLOPPIES   6)
  43.  
  44. (set MBYTE                  (* 1024 1024))
  45. (set MBYTE-1                (- MBYTE 1))
  46.  
  47. (set DM2_PATH               ("DM2"))
  48. (set JOIN_APP               ("Join"))
  49. (set ARC_APP                ("unlzx"))
  50. ;(set ARC_APP                ("LhA"))
  51. (set ARC_SCPT               ("DM2_unarc_scpt"))
  52.  
  53. (set BASE_FLOPPY_VOL        ("DM2_SK_Install"))
  54. (set BASE_FLOPPY_FILE       ("DM2_arcsplit"))
  55. (set JOINED_ARCHIVE_NAME    ("DM2_archive.LZX"))
  56. (set JOINED_TMPARC_NAME     ("DM2_tmparc"))
  57.  
  58.  
  59.  
  60. ;=========================================================================
  61. ; Declare variables (wish this were required!!)
  62. ;=========================================================================
  63.  
  64.  
  65. (set volume_avail           0)
  66. (set result                 0)
  67. (set cur_floppy_num         1)
  68.  
  69. (set cur_dest_path          "")
  70. (set joined_archive_path    "")
  71. (set joined_tmparc_path     "")
  72. (set cur_floppy_vol         "")
  73. (set cur_floppy_file        "")
  74. (set cur_floppy_path        "")
  75.  
  76. (set temp_str               "")
  77. (set temp_vol               "")
  78. (set temp_path              "")
  79.  
  80. (set cur_language         ENGL)       ; temp
  81.  
  82.  
  83.  
  84. ;=========================================================================
  85. ; Initialize language strings
  86. ;=========================================================================
  87.  
  88.  
  89. (set cur_language ENGL)         ; temporarialy force to english
  90.  
  91. ;(set cur_language
  92. ;    (askchoice
  93. ;        (prompt "temp debug - select language:")
  94. ;        (help "hi-keeba")
  95. ;        (choices "English" "French" "German")
  96. ;        (default 0)
  97. ;    )
  98. ;)
  99.  
  100. (if (= @language GRMN)
  101.  (
  102.         (set DM2_NAME           "DungeonMaster II")
  103.         (set TRNSCPT_HDR        ("\nGerman Begin installation of \"%s\"...\n"
  104.                                 DM2_NAME))
  105.         (set NO_HELP            "No help defined for this function.")
  106.  
  107.  )  ; end-then GRMN
  108.  
  109.  (if (= @language FNCH)
  110.   (
  111.         (set DM2_NAME           "DungeonMaster II")
  112.         (set TRNSCPT_HDR        ("\nFrench Begin installation of \"%s\"...\n"
  113.                                 DM2_NAME))
  114.         (set NO_HELP            "No help defined for this function.")
  115.  
  116.   )  ; end-then FNCH
  117.  
  118.   ( ;assume (= @language ENGL)
  119.         (set DM2_NAME           "DungeonMaster II")
  120.         (set TRNSCPT_HDR        ("\nBegin installation of \"%s\"...\n"
  121.                                 DM2_NAME))
  122.  
  123.         (set CHOOSE_NEW_VOL     ("Please choose a volume on which to install %s"
  124.                                 DM2_NAME))
  125.  
  126.         (set NO_HELP            "No help defined for this function.")
  127.         (set OK_TXT             "OK")
  128.         (set CANCEL_TXT         "Cancel")
  129.         (set ABORT_TXT          "Abort")
  130.         (set CHOOSE_TXT         "Choose another")
  131.  
  132.         (set USER_ABORT_TXT     "User abort.  Install cancelled.")
  133.  
  134.   )  ; end-else !FNCH
  135.  )  ; end-else !GRMN
  136. )  ; end-if GRMN
  137.  
  138.  
  139.  
  140. ;=============================================================
  141. ; Floppy->HD Installation Procedure
  142. ;
  143. ; Copies a "split" archive file from the current floppy,
  144. ; and appends it to the single archive file in the
  145. ; install directory.
  146. ; Will ask for floppy if not currently mounted.
  147. ;
  148. ; If first floppy, also copies ARC_APP program and the
  149. ; ARC_SCPT script into the install directory so that they
  150. ; will be available later.
  151. ;
  152. ; Arguments:
  153. ;   @default-dest       Path to install directory.
  154. ;   cur_floppy_num      Integer value for current floppy
  155. ;                       in sequence (1..NUM_INSTALL_FLOPPIES).
  156. ;   joined_archive_path Path and filename of the archive file
  157. ;                       being built.
  158. ;   joined_tmparc_path  Path and filename of a temporary
  159. ;                       file which exists as the data copied
  160. ;                       from the floppy is appended to the
  161. ;                       archive file being built.
  162. ;
  163. ; Variables modified:
  164. ;   cur_floppy_vol
  165. ;   cur_floppy_file
  166. ;   cur_floppy_path
  167. ;   cur_dest_path
  168. ;=============================================================
  169.  
  170.  
  171. (procedure InstallOneFloppy
  172.   (
  173.     (set cur_floppy_vol (cat BASE_FLOPPY_VOL cur_floppy_num))
  174.     (set cur_floppy_file (cat BASE_FLOPPY_FILE cur_floppy_num))
  175.     (set cur_floppy_path (tackon (cat cur_floppy_vol ":") cur_floppy_file))
  176.     (set cur_dest_path (tackon @default-dest cur_floppy_file))
  177.  
  178.     (askdisk
  179.         (prompt ("\nPlease insert %s\nInstall Disk %ld (of %ld)"
  180.                  DM2_NAME cur_floppy_num NUM_INSTALL_FLOPPIES)
  181.         )
  182.         (help @askdisk-help)
  183.         (dest cur_floppy_vol)  ; note - terminating colon not allowed
  184.     )
  185.  
  186.     (copyfiles
  187.         (prompt ("Copying from %s..." cur_floppy_name))
  188.         (help @copyfiles-help)
  189.         (source cur_floppy_path)
  190.         (dest @default-dest)
  191.     )
  192.  
  193.     (if (= cur_floppy_num 1)
  194.       (
  195.         (rename cur_dest_path joined_archive_path
  196.             (help NO_HELP)
  197.         )
  198.         (copyfiles
  199.             (prompt ("Copying from %s..." cur_floppy_name))
  200.             (help @copyfiles-help)
  201.             (source (tackon (cat cur_floppy_vol ":") ARC_APP))
  202.             (dest @default-dest)
  203.         )
  204.         (copyfiles
  205.             (prompt ("Copying from %s..." cur_floppy_name))
  206.             (help @copyfiles-help)
  207.             (source (tackon (cat cur_floppy_vol ":") ARC_SCPT))
  208.             (dest @default-dest)
  209.         )
  210.       )
  211.       (
  212.         (working "\nConcatenating files...")
  213.         (rename joined_archive_path joined_tmparc_path
  214.             (help NO_HELP)
  215.         )
  216.         (run (cat JOIN_APP (" <NIL: >NIL: \"%s\" \"%s\" AS \"%s\""
  217.                             joined_tmparc_path cur_dest_path
  218.                             joined_archive_path))
  219.             (prompt "Building archive file...")
  220.             (help NO_HELP)
  221.         )
  222.         (delete joined_tmparc_path
  223.             (help NO_HELP)
  224.         )
  225.         (delete cur_dest_path
  226.             (help NO_HELP)
  227.         )
  228.       )
  229.     )
  230.   )
  231. )  ; end-procedure InstallOneFloppy
  232.  
  233.  
  234.  
  235. ;=========================================================================
  236. ; Begin install
  237. ;=========================================================================
  238.  
  239.  
  240. (transcript TRANSCPT_HDR)  ; write header to log file
  241.  
  242.  
  243. ;========================================
  244. ; Check CPU and abort if less than 68020.
  245. ;========================================
  246.  
  247.  
  248. (if (< (database "cpu") 68020)
  249.   (
  250.     (abort ("Sorry, %s requires at least a 68020 CPU to run."
  251.             DM2_NAME)
  252.     )
  253.   )
  254. )
  255.  
  256.  
  257. ;========================================================
  258. ; If there is sufficient free space on the install-volume
  259. ; to perform the install, tell the user where we plan to
  260. ; put the files.  Allow the user to select an alternate
  261. ; volume and/or path for the installation.
  262. ;========================================================
  263.  
  264.  
  265. (if (>= (getdiskspace (cat (getdevice @default-dest) ":")) INSTALL_SPACE)
  266.   (
  267.     ;==================================================
  268.     ; Confirm with user that installation volume is OK.
  269.     ;==================================================
  270.  
  271.     (set temp_str (
  272.         "\nReady to install %s on volume \"%s:\" in drawer \"%s\".\n\nPress \"OK\" to begin the installation.\nOr, press \"%s\" to select an alternate installation volume."
  273.         DM2_NAME
  274.         (getdevice @default-dest)
  275.         DM2_PATH
  276.         CHOOSE_TXT)
  277.     )
  278.     (set result
  279.         (askbool
  280.             (prompt temp_str)
  281.             (help NO_HELP)
  282.             (default 0)
  283.             (choices OK_TXT CHOOSE_TXT)
  284.         )
  285.     )
  286.     (if (= result 0)
  287.       (
  288.         ;==================================
  289.         ; Get new install volume from user.
  290.         ;==================================
  291.  
  292.         (set tmp_vol
  293.             (askdir
  294.                 (prompt CHOOSE_NEW_VOL)
  295.                 (help @askdir-help)
  296.                 (default @default-dest)
  297.                 (newpath DM2_PATH)
  298.                 (disk)
  299.             )
  300.         )
  301.         (set @default-dest tmp_vol)
  302.       )
  303.     )
  304.   )
  305. )
  306.  
  307.  
  308. ;==========================================================
  309. ; Make sure the install-volume has sufficient free space
  310. ; to perform the install.  If it doesn't, let the user know
  311. ; how much space is required and ask the user to select an
  312. ; alternate volume.
  313. ;==========================================================
  314.  
  315.  
  316. (while (< (set volume_avail (getdiskspace
  317.                                 (cat (getdevice @default-dest) ":")))
  318.           INSTALL_SPACE)
  319.   (
  320.     ;==================================================
  321.     ; Inform user insufficient space on selected drive.
  322.     ;==================================================
  323.  
  324.     (set temp_vol (getdevice @default-dest))
  325.     (set temp_str (
  326.          "\nNot enough space on volume \"%s:\" to install.\n\nApproximately %ld megs of space is required during the install (only %ld megs will be used when the installation is complete.)  This volume has %ld megs available."
  327.          temp_vol
  328.          (/ (+ INSTALL_SPACE MBYTE-1) MBYTE)
  329.          (/ (+ FINAL_SPACE MBYTE-1) MBYTE)
  330.          (/ volume_avail MBYTE))
  331.     )
  332.     (set temp_str
  333.         (cat temp_str (
  334.             "\n\nPress \"%s\" to choose a new volume on which to install %s."
  335.             CHOOSE_TXT
  336.             DM2_NAME)
  337.         )
  338.     )
  339.     (set result
  340.         (askbool
  341.             (prompt temp_str)
  342.             (help NO_HELP)
  343.             (default 0)
  344.             (choices CHOOSE_TXT ABORT_TXT)
  345.         )
  346.     )
  347.     (if (= result 0)
  348.         (abort USER_ABORT_TXT)
  349.     )
  350.  
  351.     ;==================================
  352.     ; Get new install volume from user.
  353.     ;==================================
  354.  
  355.     (set tmp_vol
  356.         (askdir
  357.             (prompt CHOOSE_NEW_VOL)
  358.             (help @askdir-help)
  359.             (default @default-dest)
  360.             (newpath DM2_PATH)
  361.             (disk)
  362.         )
  363.     )
  364.     (set @default-dest tmp_vol)
  365.   )
  366. )
  367.  
  368.  
  369. ;=========================================================
  370. ; Now, the user has approved the install path, and we have
  371. ; verified there is sufficient free space on the volume to
  372. ; perform the install.  Here, we'll tack on the "DM2"
  373. ; drawer name, and make the directory.
  374. ;=========================================================
  375.  
  376.  
  377. (set @default-dest (tackon @default-dest DM2_PATH))
  378.  
  379. (makedir @default-dest
  380.     (help @makedir-help)
  381.     (infos)
  382. )
  383.  
  384.  
  385. ;=======================================================
  386. ; Copy data from all floppies, building a single archive
  387. ; file in the install directory.
  388. ;=======================================================
  389.  
  390.  
  391. (set joined_archive_path (tackon @default-dest JOINED_ARCHIVE_NAME))
  392. (set joined_tmparc_path (tackon @default-dest JOINED_TMPARC_NAME))
  393. (set cur_floppy_num 1)
  394.  
  395. (while (<= cur_floppy_num NUM_INSTALL_FLOPPIES)
  396.   (
  397.     (complete (/ (* cur_floppy_num 75) NUM_INSTALL_FLOPPIES))
  398.     (InstallOneFloppy)
  399.     (set cur_floppy_num (+ cur_floppy_num 1))
  400.   )
  401. )
  402.  
  403.  
  404. (working "\nDecompressing files.\nThis may take some time...")
  405.  
  406. ;(run "setenv <NIL: >NIL: installer-result 10")
  407. ;(set result (getenv "installer-result"))
  408. ;(message ("pre result %ld" result))
  409.  
  410. (execute (cat "<NIL: >NIL: \"" (tackon @default-dest ARC_SCPT)
  411.               "\" \"" @default-dest "\" \"" ARC_APP
  412.               "\" \"" JOINED_ARCHIVE_NAME "\"")
  413.     (prompt "Extracting files from archive...")
  414.     (help NO_HELP)
  415. )
  416.  
  417. ;(set result (getenv "installer-result"))
  418. ;(message ("post result %ld" result))
  419.  
  420.  
  421. ;====================================
  422. ; Create save directory if necessary.
  423. ;====================================
  424.  
  425. (complete 98)
  426.  
  427. (set temp_path (tackon @default-dest "save"))
  428. (set result (exists temp_path (noreq)))
  429. (if (= result 0)
  430.     (makedir temp_path
  431.         (prompt "Creating save directory...")
  432.         (help NO_HELP)
  433.     )
  434. )
  435.  
  436.  
  437. ;==================
  438. ; Cleanup and exit.
  439. ;==================
  440.  
  441. (complete 99)
  442.  
  443. (delete joined_archive_path
  444.     (help NO_HELP)
  445. )
  446. (delete (tackon @default-dest ARC_APP)
  447.     (help NO_HELP)
  448. )
  449. (delete (tackon @default-dest ARC_SCPT)
  450.     (help NO_HELP)
  451. )
  452.  
  453. (complete 100)
  454.  
  455.  
  456. ; EOF
  457.  
  458.